package neo.aoi;

import java.io.PrintStream;

/**
 * ExportProgressPrinter displays the status of an export operation. By default
 * ExportProgressPrinter prints progress messages to the standard output stream.
 * The <code>ExportProgressPrinter(PrintStream out)</code> constructor can be
 * used to specify an alternateive PrintStream.
 * 
 * @author Carlos Martinez
 */
public class ExportProgressPrinter implements ExportProgressListener {

	private PrintStream _out;

	/**
	 * Creates a new ExportProgressPrinter which prints progress messages to the
	 * standard output stream.
	 */
	public ExportProgressPrinter() {
		_out = System.out;
	}

	/**
	 * Creates a new ExportProgressPrinter which prints progress messages to the
	 * given PrintStream
	 * 
	 * @param out
	 *            The PrintStream to be used
	 */
	public ExportProgressPrinter(PrintStream out) {
		_out = out;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see neo.aoi.ProgressListener#alertObject(int, int)
	 */
	public void alertObject(int currObj, int totalObjects) {
		_out.println("ExportProgressPrinter: alertObject(" + currObj + " / "
				+ totalObjects + ")");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see neo.aoi.ProgressListener#finished()
	 */
	public void finished() {
		_out.println("ExportProgressPrinter: Finished");
	}
}
